
DUMP=NONE
TOP=tb
DEBUG_COMP_OPTS += -assert svaext
LINT_COMP_OPTS  += +lint=all,noVCDE,noNS
#TOP=pe_array
TB_VLOG_F  = -f ./tb.vc
VLOG_COMP_OPTS += -full64  -LDFLAGS -Wl,--no-as-needed  -lca -kdb
VLOG_COMP_OPTS += -sverilog -v2k_generate
VLOG_COMP_OPTS += -timescale=1ps/1ps
VLOG_COMP_OPTS += +define+VCS
VLOG_COMP_OPTS += $(TB_VLOG_F)
VLOG_COMP_OPTS += $(DEBUG_COMP_OPTS)
VLOG_COMP_OPTS += $(LINT_COMP_OPTS)
VLOG_COMP_OPTS += $(UVM_COMP_OPTS)
VLOG_COMP_OPTS += $(RAL_COMP_OPTS)
VLOG_COMP_OPTS += +incdir+./+incdir+../dut/

VSIM_OPTS += -LDFLAGS -Wl,--no-as-needed  -lca -kdb

TB_TOP_MODEL_NAME  = tb
LICENSE_OPTS    += +error+1000
LINT_COMP_OPTS  += +lint=all,noVCDE,noNS
DEBUG_COMP_OPTS += 
#DEBUG_ELAB_OPTS += -debug_access+pp+drivers
DEBUG_ELAB_OPTS += -debug_pp 

ELAB_OPTS += -full64
ELAB_OPTS += $(LICENSE_OPTS)
ELAB_OPTS += $(DEBUG_ELAB_OPTS)
ELAB_OPTS += $(UVM_ELAB_OPTS)
ELAB_OPTS += $(COV_ELAB_OPTS)
ELAB_OPTS += $(OPT_CONFIG_F)
ELAB_OPTS += $(XILINX_CORE_ELAB_OPTS)
ELAB_OPTS += +lint=TFIPC-L

RUN_OPTS +=	$(LICENSE_OPTS)
RUN_OPTS +=	$(DEBUG_RUN_OPTS)
RUN_OPTS += $(RAL_RUN_OPTS)
RUN_OPTS += $(COV_RUN_OPTS)
RUN_OPTS += +UVM_TESTNAME=base_test
RUN_OPTS +=	+vpdfileswitchsize+3000
RUN_OPTS +=	+ntb_random_seed=$(SEED)
RUN_OPTS +=	+notimingcheck

CFLAG	   = -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -g
C_HOME = ../test_pe

test:
	vcs -static_debug -f tb.vc -sverilog -full64 -assert svaext

comp:
	rm -rf mywork
	mkdir -p mywork
	echo "\`define  $(DUMP)       "  >    define.v ;
	@echo "comp start time is:" `date '+%Y-%m-%d %H:%M:%S'` >> time.log
	vlogan -work mywork ${VLOG_COMP_OPTS}     -l comp_vlog.log
	@echo "comp end   time is:" `date '+%Y-%m-%d %H:%M:%S'` >> time.log

elab:
	@echo "elab start time is:" `date '+%Y-%m-%d %H:%M:%S'` >> time.log
	##vcs mywork.$(TB_TOP_MODEL_NAME) $(ELAB_OPTS) $(OBJ_LIST)  -dpi  my_matlab.so    -l elab.log -P  /usr/synopsys/Verdi3_L-2016.06-1/share/PLI/VCS/LINUX64/novas.tab   /usr/synopsys/Verdi3_L-2016.06-1/share/PLI/VCS/LINUX64/pli.a 
	vcs -full64 -cpp g++-4.8 -cc gcc-4.8   ${VSIM_OPTS}  mywork.$(TB_TOP_MODEL_NAME) $(ELAB_OPTS) $(OBJ_LIST)     -l elab.log -P  /usr/synopsys/Verdi3_L-2016.06-1/share/PLI/VCS/LINUX64/novas.tab   /usr/synopsys/Verdi3_L-2016.06-1/share/PLI/VCS/LINUX64/pli.a 
	@echo "elab end   time is:" `date '+%Y-%m-%d %H:%M:%S'` >> time.log

run:
	@echo "run  start time is:" `date '+%Y-%m-%d %H:%M:%S'` >> time.log
	##./simv $(RUN_OPTS)   -l run.log
	./simv $(RUN_OPTS)  -sv_lib my_matlab  -l run.log
	@echo "run  end   time is:" `date '+%Y-%m-%d %H:%M:%S'` >> time.log

sim: clean comp elab run

clean:
	cp ../cmodel/demo/*.so ./
	rm -rf simv*  mywork  csrc*  DVEfiles  verdiLog  *.vpd *.fsdb *.bak *.log  novas*  ucli.key  ../verdiLog  


emacs:
	cp ../dut/fft_st/fft_st.v  ./	
	emacs   --batch   tb.sv             -f verilog-auto     -f save-buffer 	
	rm fft_st.v

verdi:
	verdi -sv -f tb.vc -top tb  &

dve:
	dve -full64 -vpd vcdplus.vpd &


